# coding: utf-8
from datetime import datetime
from sqlalchemy import Column, String, DATETIME, text, func
from sqlalchemy.dialects.mysql import INTEGER
from ..database import db,serialize

class RolePriv(db.Model):
    __tablename__ = 'role_privs'

    id = Column(INTEGER(10), primary_key=True)
    menu_id = Column(INTEGER(10), nullable=False)
    role_id = Column(INTEGER(10), nullable=False, index=True)
    name = Column(String(20, 'utf8mb4_unicode_ci'), nullable=False)
    url = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, index=True)
    label = Column(String(100, 'utf8mb4_unicode_ci'), nullable=False, index=True)
    created_at = Column(DATETIME, default=datetime.now())
    updated_at = Column(DATETIME, default=datetime.now(
    ), server_default=func.now(), onupdate=func.now(), comment='修改时间')
